import axios from '@/utils/request'
// 加入购物车
// goods 商品id
// goodsSkuId 商品规格id 红色的iPhone8 粉色的iPhone8
export const addCart = (goodsId, goodsNum, goodsSkuId) => {
  return axios.post('http://smart-shop.itheima.net/index.php?s=/api/cart/add', {
    goodsId,
    goodsNum,
    goodsSkuId
  })
}

// 获取购物车商品信息
export const getCartList = () => {
  return axios.get('http://smart-shop.itheima.net/index.php?s=/api/cart/list')
}

// 购物车商品数量更新
export const changeCount = (goodsId, goodsNum, goodsSkuId) => {
  return axios.post('http://smart-shop.itheima.net/index.php?s=/api/cart/update', {
    goodsId,
    goodsNum,
    goodsSkuId
  })
}

// 删除购物车商品
export const delSelect = (cartIds) => {
  return axios.post('http://smart-shop.itheima.net/index.php?s=/api/cart/clear', {
    cartIds
  })
}
